home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Interactive 7
/
PC World Interactive 7.iso
/
program
/
ctutord.EXE
/
PTRS2.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-07-16
|
722b
|
41 lines
/* ptrs2.c */
/*
The output produced from this program:
hi - see ya
print: I'm really using printf
The new string we created is: hi - see ya
z
Now I'm done
*/
main()
{
int printf(), putchar();
int (*print)();
char merge[80];
static char *z[] = {
"hi - ", "bye", "see ya", ""
};
print = printf;
func( z[0], z[2], merge, print );
print("print: I'm really using printf\n");
print("The new string we created is: %s\n", merge);
print = putchar;
print('z');
printf("\nNow I'm done\n");
}
/*
func:
create one string from 2 strings
*/
func(st1, st2, st, fun )
char *st1, *st2, *st;
int (*fun)();
{
strcpy(st, st1);
strcat(st, st2);
(*fun)("%s\n", st);
}